from selenium import webdriver

from Buiness.LoginPage import LoginPage
from common.BasePage import BasePage

class MainPage(BasePage):
    def __init__(self,driver):
        super().__init__(driver)
        self.system_manage_loc = "xpath,//*[@id='s-menu-superadmin']/button"
        self.system_manage_frame_name="iframe-superadmin"
        self.assert_text_loc = "link text,签退"
        # self.back_stage_manage="xpath,/html/body/div[1]/div[1]/div/ul[1]/li[8]/button/i"
        # self.add_members="xpath,/html/body/div[2]/div/div/div[1]/div/a/h3"
        # self.username="id,account"
        # self.realname="id,realname"
        # self.sex_man="id,genderm"
        # self.sex_wamen="id,genderf"
        # self.role="id,role"
        # self.password1="id,password1"
        # self.password2="id,password2"
        # self.email="id,email"
        # self.save="id,submit"

    # def click_back(self):
    #     self.click(self.back_stage_manage)
    #     self.wait(1)
    #
    # def click_add_manage(self):
    #     self.click(self.add_members)
    #     self.wait(1)
    #
    # def enter_system_manage(self):
    #     self.click(self.system_manage_loc)
    #     self.into_frame(self.system_manage_frame_name)

    def enter_username(self,username):
        self.input(self.username,username)
        self.wait(1)

    def enter_realname(self,realname):
        self.input(self.realname,realname)
        self.wait(1)

    def click_man(self):
        self.click(self.sex_man)
        self.wait(1)

    def click_wamen(self):
        self.click(self.sex_wamen)
        self.wait(1)

    def select_role(self,num):
        self.dropdown(self.role,num)
        self.wait(1)

    def enter_password1(self,password1):
        self.input(self.password1,password1)
        self.wait(1)

    def enter_password2(self, password2):
        self.input(self.password2, password2)
        self.wait(1)

    def enter_email(self,email):
        self.input(self.email,email)
        self.wait(1)

    def click_save(self):
        self.click(self.save)
        self.wait(2)

    def get_assert_text(self):
        return self.get_ele_text(self.assert_text_loc)

